package com.ysd.lis.controller.samsto;



import com.ysd.lis.annotation.MainInfoLog;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ysd.lis.entity.samsto.SamstoStorageFridge;
import com.ysd.lis.dto.samsto.SamstoStorageFridgeDto;
import com.ysd.lis.request.samsto.SamstoStorageFridgeParam;
import com.ysd.lis.service.samsto.SamstoStorageFridgeService;
import com.ysd.lis.aspect.OperationType;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.ApiOperation;
import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;

/**
 * (SamstoStorageFridge)表控制层
 *
 * @author leiming
 * @since 2024-10-28 15:23:04
 */
@RestController
@RequestMapping("/api/samsto/samstoStorageFridge")
public class SamstoStorageFridgeController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private SamstoStorageFridgeService samstoStorageFridgeService;


    /**
     * 分页查询所有数据
     *
     * @param pageParam 查询实体
     * @return 所有数据
     */
    @ApiOperation("根据组ID获取数据")
    @PostMapping("/findByGId")
    public Result findByGId(@RequestBody SamstoStorageFridgeParam pageParam) {

        return samstoStorageFridgeService.findListByGId(pageParam);
    }

    /**
     * 分页查询所有数据
     *
     * @param pageParam 查询实体
     * @return 所有数据
     */
    @ApiOperation("获取列表（分页)")
    @PostMapping("/pagelist")
    public Result pagelist(@RequestBody SamstoStorageFridgeParam pageParam) {
        return samstoStorageFridgeService.findPageList(pageParam);
    }

    /**
     * 通过主键查询单条数据
     *
     * @param param 主键
     * @return 单条数据
     */
    @ApiOperation("根据ID获取表单数据")
    @PostMapping("/getInfoById")
    public Result selectOne(@RequestBody SamstoStorageFridgeParam param) {
        return samstoStorageFridgeService.getInfoById(param.getId());
    }


    /**
     * 通过主键查询单条数据
     *
     * @param param 主键
     * @return 单条数据
     */
    @ApiOperation("根据ID获取表单数据")
    @GetMapping("/getAllList")
    public Result getAllList(SamstoStorageFridgeParam param) {
        return samstoStorageFridgeService.getAllList(param);
    }
    /**
     * 根据仓库获取冰箱集合
     *
     * @param param 主键
     * @return 单条数据
     */
    @ApiOperation("根据仓库获取冰箱集合")
    @GetMapping("/getStorageFridgeList")
    public Result getStorageFridgeList(SamstoStorageFridgeParam param) {
        return samstoStorageFridgeService.getStorageFridgeList(param);
    }

    /**
     * 通过主键查询单条数据
     *
     * @return 单条数据
     */
    @ApiOperation("根据ID获取表单数据")
    @GetMapping("/getStorageFridgeById")
    public Result getStorageFridgeById(SamstoStorageFridge samstoStorageFridge) {
        return samstoStorageFridgeService.getStorageFridgeById(samstoStorageFridge);
    }

    /**
     * 新增数据
     *
     * @param param 实体对象
     * @return 新增结果
     */
    @ApiOperation("添加信息")
    @PostMapping("/add")
    public Result add(@RequestBody SamstoStorageFridgeParam param) {
        return samstoStorageFridgeService.add(param);
    }

    /**
     * 修改数据
     *
     * @param param 实体传值对象
     * @return 修改结果
     */
    @ApiOperation("修改信息")
    @PostMapping("/edit")
    public Result edit(@RequestBody SamstoStorageFridgeParam param) {
        return samstoStorageFridgeService.edit(param);
    }

    /**
     * 删除数据
     *
     * @param ids 主键结合
     * @return 删除结果
     */
    @ApiOperation("真删除信息")
    @PostMapping("/delete")
    public Result delete(@RequestBody List<String> ids) {
        return this.samstoStorageFridgeService.delete(ids);
    }

    /**
     * 修改数据
     *
     * @param param 实体传值对象
     * @return 修改结果
     */
    @ApiOperation("修改信息")
    @PostMapping("/saveAll")
    public Result saveOrUpdateAll(@RequestBody SamstoStorageFridgeParam param) {
        return this.samstoStorageFridgeService.saveOrUpdateList(param);
    }
}

